﻿/****************************************************************
 * Copyright (c) 2010-2013 Besture All Rights Reserved.
 * 
 * File Name:		ConfigUtilify 
 * 
 * Created:		2013-1-28 18:32:51
 * Original Author:	nitao 
 * 
 * ------------------------------------------------------------
 * MODIFICATION HISTORY
 * ------------------------------------------------------------
 * When			Who		Why
 * ------------------------------------------------------------
 * 
 *
 ****************************************************************/

using System;
using System.Web.Configuration;

namespace Besture.Utils
{
    public class ConfigUtilify
    {

        public static string ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
        /// <summary>
        /// 取得EMAIL主机地址
        /// </summary>
        /// <returns></returns>
        public static String GetEmailHost()
        {
            return WebConfigurationManager.AppSettings["EMAIL_HOST_IP"] as String;
        }

        /// <summary>
        /// 取得邮件模板
        /// </summary>
        /// <returns></returns>
        public static String GetMailTemplatePath()
        {
            return WebConfigurationManager.AppSettings["MailTemplatePath"] as String;
        }

        /// <summary>
        /// 取得EMAIL主机端口
        /// </summary>
        /// <returns></returns>
        public static int GetEmailPort()
        {
            try
            {
                return int.Parse(WebConfigurationManager.AppSettings["EMAIL_PORT"]);
            }
            catch (Exception)
            {
                return 0;
                throw;
            }
        }
        /// <summary>
        /// 取得EMAIL用户名
        /// </summary>
        /// <returns></returns>
        public static String GetEmailUserName()
        {
            return WebConfigurationManager.AppSettings["EMAIL_USER_NAME"] as String;
        }
        /// <summary>
        /// 取得EMAIL密码
        /// </summary>
        /// <returns></returns>
        public static String GetEmailPassword()
        {
            return WebConfigurationManager.AppSettings["EMAIL_PASSWORD"] as String;
        }
        
        /// <summary>
        /// 后台列表分页
        /// </summary>
        public static string ADMIN_PAGE_SIZE = WebConfigurationManager.AppSettings["ADMIN_PAGE_SIZE"];

    }
}
